#include "my_group.h"

My_group::My_group(const QString &title, QWidget *parent) : QGroupBox(title, parent)
{
    this->setAlignment(Qt::AlignCenter);
    lf = new My_label("左前", this);
    rf = new My_label("右前", this);
    lb = new My_label("左后", this);
    rb = new My_label("右后", this);
    layout = new QGridLayout();
    layout->addWidget(lf, 0, 0);
    layout->addWidget(rf, 0, 1);
    layout->addWidget(lb, 1, 0);
    layout->addWidget(rb, 1, 1);
    layout->setContentsMargins(LEFT_M, TOP_M, RIGHT_M, BOTTOM_M);
    layout->setSpacing(SPACE_SON);
    this->setLayout(layout);
}

void My_group::setNum(double nlf, double nrf, double nlb, double nrb)
{
//    lf->set_num(nlf);
//    rf->set_num(nrf);
//    lb->set_num(nlb);
//    rb->set_num(nrb);

    lf->set_text(QString::number(nlf, 'f', 3));
    rf->set_text(QString::number(nrf, 'f', 3));
    lb->set_text(QString::number(nlb, 'f', 3));
    rb->set_text(QString::number(nrb, 'f', 3));
}

void My_group::setText(const QString &tlf, const QString &trf, const QString &tlb, const QString &trb)
{
    lf->set_text(tlf);
    rf->set_text(trf);
    lb->set_text(tlb);
    rb->set_text(trb);
}

